package com.cloud.code.真题;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Demo33 {

    public static void main(String[] args) {
        function("1234567890abcd9.+12345.678.9ed");
    }

    public static String function(String s) {
        Pattern pattern = Pattern.compile("[+-]?[0-9]+(\\.[0-9]+)?");
        Matcher matcher = pattern.matcher(s);
        List<String> list = new ArrayList<>();
        int i = 0;
        while (matcher.find(i)) {
            list.add(matcher.group());
            i = matcher.start() + 1;
        }
        System.out.println(list);
        String result = "";
        for (String target : list) {
            if (target.length() >= result.length()) {
                result = target;
            }
        }
        System.out.println(result);
        return result;
    }
}
